package model.connections;

import model.connectible.Connectible;



public class Connection {
	
	private Connectible nodeA;
	private Connectible nodeB;
	private double stability;
	private int bandwidth;
	
	public Connection(Connectible nodeA, Connectible nodeB, double stability, int bandwidth) {
		setNodeA(nodeA);
		setNodeB(nodeB);
		setStability(stability);
		setBandwidth(bandwidth);
	}
	
	public Connectible getOther(Connectible node) {
		Connectible n = null;
		if(node == nodeA) {
			n = nodeB;
		} else if(node == nodeB) {
			n = nodeA;
		}
		return n;
	}
	
	public Connectible getNodeA() {
		return nodeA;
	}

	public void setNodeA(Connectible nodeA) {
		this.nodeA = nodeA;
	}

	public Connectible getNodeB() {
		return nodeB;
	}

	public void setNodeB(Connectible nodeB) {
		this.nodeB = nodeB;
	}

	public double getStability() {
		return stability;
	}
	public void setStability(double stability) {
		this.stability = stability;
	}
	public int getBandwidth() {
		return bandwidth;
	}
	public void setBandwidth(int bandwidth) {
		this.bandwidth = bandwidth;
	}
	
	public Connection clone() {
		return new Connection(nodeA, nodeB, stability, bandwidth);
	}
}
